package Extra01;

public class Triangulo extends FiguraGeometrica {	
	
	private double _ladoa;
	private double _ladob;
	private double _ladoc;
	
	private Triangulo(double l1,double l2,double l3)
	{
		this.set_ladoa(l1);
		this.set_ladob(l2);
		this.set_ladoc(l3);
	}
	
	public static Triangulo CrearTrianguloEquilatero(double a)
	{
		return CrearTrianguloIsoceles(a,a);
	}
	public static Triangulo CrearTrianguloIsoceles(double a, double b)
	{
		return CrearTrianguloEscaleno(a,b,b);
	}
	public static Triangulo CrearTrianguloEscaleno(double a, double b, double c)
	{
		return new Triangulo(a,b,c);
	}

	
	private void set_ladoa(double _ladoa) {
		this._ladoa = _ladoa;
	}
	private void set_ladob(double _ladob) {
		this._ladob = _ladob;
	}
	private void set_ladoc(double _ladoc) {
		this._ladoc = _ladoc;
	}
	

	public double get_ladoa() {
		return _ladoa;
	}
	public double get_ladob() {
		return _ladob;
	}
	public double get_ladoc() {
		return _ladoc;
	}
	
	public String getInfo() {
		String texto;
		texto = "Figura Geometrica: Triangulo.\n";
		texto += "Lado a: "+ this.get_ladoa() + ".\n";
		texto += "Lado b: "+ this.get_ladob() + ".\n";
		texto += "Lado c: "+ this.get_ladoc() + ".";
		return texto;
	}

	public String getArea() {
		double p = Double.parseDouble(this.getPerimetro());
		double sp = p/2;
		double ap = sp - this.get_ladoa();
		double bp = sp - this.get_ladob();
		double cp = sp - this.get_ladoc();
		double abcp = sp * ap * bp * cp;
		double res = Math.sqrt(abcp);
		return Double.toString(res);
	}
	public String getPerimetro() {
		double res = this._ladoa + this._ladob + this._ladoc;
		return Double.toString(res);
	}

}
